<?php
include_once("config/DB.php");
class Order
{
	private $id;
	private $renter;//承租方ID
	private $borrower;//租客ID
	private $restorer;//归还方ID
	private $state;

	private $Rcode;//code for renter to scan or enter
	private $SetTime;
	private $endTime;
	private $Uid;
	
	public function __construct($Uid,$Rid="")
	{
		if(/*数据库里面找不到Uid*/1)
		{
		    //$this->SetTime=time();//这里谁会用时间函数，转成SQL标准时间的？
		    $this->renter=$Rid;
		    $this->Uid=$Uid;
		    $this->Rcode="";//调用二维码生成函数，要求是扫描该二维码的时候给出链接，该链接为对用户的行为作出进一步的操作
		    $this->state=0;
		
		    $db= new DB();
		    $db->getDB("sql_flyingwings");
			$db->insert("Orders","
	}
	public function setBorrower($bid)
	{
		$this->borrower=$bid;
	}
	public function getBorrower()
	{
		return $this->borrower;
	}
	public function setRenter($Rid)
	{
		$this->renter=$Rid;
	}
	public function getRenter()
	{
		return $this->renter;
	}
	public function setRestorer($ResID)
	{
		$this->restorer=$ResID;
	}
	public function getRestorer()
	{
		return $this->restorer;
	}	
}
	
/*	
Order state
0->After scanning or entering the id of Umbrella
1->User scanning the code or entering the number,and it means order created
2->Failed to create the order 
3->User clicked and ready to restore
4->successfully restored and ready to ready for state checking 
5->outdated ,redirect to pay all debts
6->state checking , no damage
7->state checking , slightly damaged
8->serioursly damaged and unable to use
9->money paid and ready for comment
10->all finished 

0->1   or   0->2

1->3   or   1->5

3->4

4->6   or   4->7   or   4->8

6,7,8->9 
*/